package com.ylxn.elasticsearch;

import org.apache.http.HttpHost;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.indices.GetIndexRequest;
import org.elasticsearch.client.indices.GetIndexResponse;

import java.io.IOException;

/**
 * @author: coll man
 * @create: 2021-05-17 09:49
 */
public class es_search {
    public static void main(String[] args) throws IOException {
        RestHighLevelClient client = new RestHighLevelClient(
                RestClient.builder(new HttpHost("localhost",9200,"http"))
        );
        GetIndexRequest r = new GetIndexRequest("user233211");
        GetIndexResponse response = client.indices().get(r, RequestOptions.DEFAULT);


        System.out.println("getMappings： = "+response.getMappings());
        System.out.println("getAliases： = "+response.getAliases());
        System.out.println("getIndices： = "+response.getIndices());
        System.out.println("getSettings： = "+response.getSettings());
        System.out.println(response);
        client.close();
    }
}
